﻿@using GoodMan.Infrastructure.Entities.Entity;
@using GoodMan.Infrastructure.Entities.Enum;
@{
    ViewBag.Title = "订单统计";
    Layout = "~/Areas/WorkSpace/Views/Shared/_OfficerTemplete.cshtml";
    ItemListBox<Order> orderList = ViewBag.OrderList;
}
 
    <link type="text/css" rel="Stylesheet" href="/content/css/select2.css" />
<div id="content-header">
    <h1>订单统计</h1>
</div>
<div id="breadcrumb">
	<a href="index.html" title="Go to Home" class="tip-bottom"><i class="icon-home"></i>首页</a>
	<a href="/workspace/Officer/OrdersStatistics" class="tip-bottom">订单管理</a>
	<a href="/workspace/Officer/OrdersStatistics" class="current">订单统计</a>
</div>
<div class="container-fluid">
  <div class="row-fluid">
     <div class="span12">
     <div class="widget-box">
			<div class="widget-title">			
				<h5>订单统计</h5>
			</div>
            <form id="frmorderquery" action="/workspace/Officer/OrdersStatistics" method="get">
             <div style="width: 80%; margin: 0px auto;">
                <table  border="0" cellpadding="0" cellspacing="0">
                    <tr align="center">                   
                        <td style="width:3%;">真实姓名：</td>
                        <td style="width:10%;">
                            <input type="text" name="realName" value="@ViewBag.realName" style="width:100px; margin-top:10px;"/>
                        </td>
                        <td style="width:5%;">&nbsp;&nbsp;时间段：</td>
                        <td style="width:26%;">
                            <input id="dtstart" readonly="readonly" name="dtstart" value="@ViewBag.dtstart" type="text" onClick="WdatePicker({skin:'blue',dateFmt:'yyyy-MM-dd'})" style="width:100px; margin-top:10px;" class="{dateISO:true}"/> -- 
                            <input id="dtend" readonly="readonly" name="dtend" value="@ViewBag.dtend" type="text" onClick="WdatePicker({skin:'blue',dateFmt:'yyyy-MM-dd'})" style="width:100px; margin-top:10px;" class="{dateISO:true}"/>
                        </td>
                        <td style="width:3%;">&nbsp;&nbsp;交易类型：</td>
                        <td style="width:10%;">
                            <select id="status" name="status" style="width:100px; margin-top:10px;">
                            @{
                                int statu = ViewBag.status == null ? -1 : ViewBag.status;
                                
                                 if(statu==1){
			                    <option value="1" selected="selected">预定完成</option>                                 
                                 }
                                 else
                                 {
			                    <option value="1">预定完成</option>
                                 }
                                  if(statu==2){
			                    <option value="2" selected="selected">支付完成</option>
                                  }
                                  else
                                  {
			                    <option value="2">支付完成</option>
                                  }
                                  if (statu == 3)
                                  {
                                <option value="3" selected="selected">等待发货</option>}
                                  else
                                  {
                                <option value="3">等待发货</option>
                                  }
                                  if (statu == 4)
                                  {
                                <option value="4" selected="selected">交易完成</option>}
                                  else
                                  {
                                <option value="4">交易完成</option>
                                  }
                                  
                                }
		                    </select>
                        </td>
                        <td>
                            <button type="submit" class="btn btn-primary">
                                <i class="icon-search icon-white"></i>查询
                            </button>
                        </td>
                    </tr>
                </table>
            </div>
            </form>
            <div class="widget-content nopadding">
                <table class="table table-bordered data-table">
					<thead>
					<tr>
					    <th width="25%">订单号</th>
					    <th width="15%">用户名称</th>
                        <th width="10%">电话</th>
					    <th width="10%">价格(/元)</th>
					    <th width="20%">下单时间</th>
                        <th width="10%">所属楼栋</th>
                        <th width="10%">状态</th>
					</tr>
					</thead>
					<tbody>
                    @{
                        if (orderList != null && orderList.Data != null && orderList.Data.Count > 0)
                        {
                            Dormitory dormitoryModel = new Dormitory();
                            foreach (var orderinfo in orderList.Data)
                            {
                                dormitoryModel = new Dormitory().Find(orderinfo.DormitoryID.ToString());
                                <tr class="gradeX">
					                <td><a href="/workspace/Officer/OrderDetail?id=@orderinfo.Id">@orderinfo.OrderCode</a></td>
					                <td>@orderinfo.UserName</td>
                                    <td>@orderinfo.Phone</td>
					                <td>@orderinfo.TotalPrice</td>
                                    <td>@orderinfo.OrderDate</td>
                                    <td>@dormitoryModel.Name</td>
					                <td>@orderinfo.Status.Mapping()</td>
					            </tr>
                            }
                        }
                        else
                        {
                            <tr class="gradeX"><td colspan="12" align="center">没有找到任何数据！</td></tr>
                        }
                    <tr class="gradeX" style="text-align:right;" align="right"><td colspan="12" align="right"><div style="text-align:right; padding-right:20px;">订单数量：<span style="font-size:16px; color:#FF0000;">@ViewBag.orderCount</span>&nbsp;总金额：<span style="font-size:16px; color:#FF0000;">&yen;@ViewBag.totalPrice</span></div></td></tr>
                    }			 
					</tbody>
			    </table>  	
			</div>
            @Html.Raw(orderList.PageItemSegment)  
        </div>
     </div>
  </div> 
</div>

@section tail{
<script type="text/javascript" src="/Scripts/jquery.validate.js"></script>
<script type="text/javascript" src="/Scripts/jquery.metadata.js"></script>
<script type="text/javascript" src="/Scripts/messages_cn.js"></script>
<script type="text/javascript" src="/Scripts/plug.js"></script>
    <script type="text/javascript" src="/scripts/select2.min.js"></script>

<script type="text/javascript">
    $(function () {
        $('#likOrder').addClass('open');

        $('#likOrder').addClass('active');
        $('#status').each(function () {
            $(this).select2();
        });
        $('#College').each(function () {
            $(this).select2();
        });
    });
</script>

}